﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HouseholdPage.aspx.cs"
    Inherits="ZhaoPin.Feature.HouseholdPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <style type="text/css">
        .Grid
        {
            border: solid 1px #93c2f1;
            width: 98%;
            font-size: 11pt;
        }
        .Grid td
        {
            border-collapse: collapse;
            border: solid 1px #93c2f1;
            font-size: 11pt;
        }
        .Grid th
        {
            border-collapse: collapse;
            border: solid 1px #93c2f1;
            font-size: 11pt;
            background-color: #e4f6ff;
        }
        .err
        {
            color: Red;
        }
    </style>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true">
    </ajaxToolkit:ToolkitScriptManager>
    <div align="center" style="width: 760px; font-size: 12pt; font-family: 新宋体;">
        <div style="padding-top: 10px; padding-bottom: 10px">
            家庭成员及主要社会关系</div>
        <asp:GridView ID="gvHousehold" runat="server" AutoGenerateColumns="False" Font-Size="15px"
            Width="760px" EmptyDataText="请添加家庭成员及主要社会关系" ShowHeaderWhenEmpty="True" CssClass="Grid"
            OnRowCommand="gvHousehold_RowCommand" DataSourceID="gvHousehold_EntityDataSource"
            DataKeyNames="Id" OnRowDataBound="gvHousehold_RowDataBound" OnRowEditing="gvHousehold_RowEditing"
            EnableViewState="False">
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <HeaderTemplate>
                        <asp:LinkButton ID="btnInsert" runat="server" CausesValidation="False" CommandName="Insert"
                            Text="新增"></asp:LinkButton>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="btnEdit" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="编辑"></asp:LinkButton>
                        <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="删除"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="姓名" DataField="Name" />
                <asp:TemplateField HeaderText="性别">
                    <ItemTemplate>
                        <asp:Label ID="lbGender" runat="server" Text='<%# Eval("TDictGender.FName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="与本人关系">
                    <ItemTemplate>
                        <asp:Label ID="lbRelation" runat="server" Text='<%# Eval("TDictRelation.FName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="政治面貌">
                    <ItemTemplate>
                        <asp:Label ID="lbParty" runat="server" Text='<%# Eval("TDictParty.FName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="工作单位" DataField="Company" />
                <asp:BoundField HeaderText="职务" DataField="Headship" />
            </Columns>
        </asp:GridView>
        <asp:EntityDataSource ID="gvHousehold_EntityDataSource" runat="server" AutoGenerateWhereClause="True"
            ConnectionString="name=RecruitContainer" DefaultContainerName="RecruitContainer"
            EnableDelete="True" EnableFlattening="False" EntitySetName="Households" EntityTypeFilter="Household"
            Select="" Where="" Include="TDictRelation,TDictParty,TDictGender" 
            ContextTypeName="" EnableInsert="True"
            EnableUpdate="True" OnInserting="gvHousehold_EntityDataSource_Inserting">
            <WhereParameters>
                <asp:SessionParameter DbType="Guid" Name="PersonId" SessionField="UserId" />
            </WhereParameters>
        </asp:EntityDataSource>
        <div style="padding-top: 10px">
            <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" OnPreRender="FormView1_PreRender"
                OnModeChanging="FormView1_ModeChanging" Visible="False" DataSourceID="gvHousehold_EntityDataSource"
                DataKeyNames="Id" OnItemUpdated="FormView1_ItemUpdated" EnableViewState="False">
                <EditItemTemplate>
                    <table>
                        <tr>
                            <td>
                                姓名
                            </td>
                            <td>
                                <asp:TextBox ID="tbName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbName"
                                    CssClass="err" Text="!"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                性别
                            </td>
                            <td>
                                <asp:DropDownList ID="ddGenderCode" runat="server" SelectedValue='<%# Bind("GenderCode") %>'
                                    DataSourceID="dsGender" DataTextField="FName" DataValueField="FGenderCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddGenderCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsGender" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictGender]"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                与本人关系
                            </td>
                            <td>
                                <asp:DropDownList ID="ddRelationCode" runat="server" SelectedValue='<%# Bind("RelationCode") %>'
                                    DataSourceID="dsRelation" DataTextField="FName" DataValueField="FRelationCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddRelationCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsRelation" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictRelation]"></asp:SqlDataSource>
                            </td>
                            <td>
                                政治面貌
                            </td>
                            <td>
                                <asp:DropDownList ID="ddPartyCode" runat="server" SelectedValue='<%# Bind("PartyCode") %>'
                                    DataSourceID="dsParty" DataTextField="FName" DataValueField="FPartyCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddPartyCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsParty" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictParty]"></asp:SqlDataSource>
                            </td>
                            <tr>
                                <td>
                                    工作单位
                                </td>
                                <td>
                                    <asp:TextBox ID="tbCompany" runat="Server" Text='<%# Bind("Company") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="tbCompany"
                                        CssClass="err" Text="!"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    职务
                                </td>
                                <td>
                                    <asp:TextBox ID="tbHeadship" runat="Server" Text='<%# Bind("Headship") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="tbHeadship"
                                        CssClass="err" Text="!"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                        </tr>
                    </table>
                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                        Text="更新"></asp:LinkButton>
                    <asp:LinkButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <table>
                        <tr>
                            <td>
                                姓名
                            </td>
                            <td>
                                <asp:TextBox ID="tbName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbName"
                                    CssClass="err" Text="!"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                性别
                            </td>
                            <td>
                                <asp:DropDownList ID="ddGenderCode" runat="server" SelectedValue='<%# Bind("GenderCode") %>'
                                    DataSourceID="dsGender" DataTextField="FName" DataValueField="FGenderCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddGenderCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsGender" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictGender]"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                与本人关系
                            </td>
                            <td>
                                <asp:DropDownList ID="ddRelationCode" runat="server" SelectedValue='<%# Bind("RelationCode") %>'
                                    DataSourceID="dsRelation" DataTextField="FName" DataValueField="FRelationCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddRelationCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsRelation" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictRelation]"></asp:SqlDataSource>
                            </td>
                            <td>
                                政治面貌
                            </td>
                            <td>
                                <asp:DropDownList ID="ddPartyCode" runat="server" SelectedValue='<%# Bind("PartyCode") %>'
                                    DataSourceID="dsParty" DataTextField="FName" DataValueField="FPartyCode">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddPartyCode"
                                    CssClass="err" Text="!" InitialValue="99999999" Display="Static"></asp:RequiredFieldValidator>
                                <asp:SqlDataSource ID="dsParty" runat="server" ConnectionString="<%$ ConnectionStrings:RecruitLocalSqlServer %>"
                                    SelectCommand="SELECT * FROM [TDictParty]"></asp:SqlDataSource>
                            </td>
                            <tr>
                                <td>
                                    工作单位
                                </td>
                                <td>
                                    <asp:TextBox ID="tbCompany" runat="Server" Text='<%# Bind("Company") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="tbCompany"
                                        CssClass="err" Text="!"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    职务
                                </td>
                                <td>
                                    <asp:TextBox ID="tbHeadship" runat="Server" Text='<%# Bind("Headship") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="tbHeadship"
                                        CssClass="err" Text="!"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                        </tr>
                    </table>
                    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                        Text="新增"></asp:LinkButton>
                    <asp:LinkButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton>
                </InsertItemTemplate>
            </asp:FormView>
        </div>
        <div style="padding-top: 10px">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableViewState="False"
                ForeColor="Red" HeaderText="请填写!号标识的内容" />
        </div>
    </div>
    </form>
</body>
</html>
